/**
 *@auther: tang
 *@Date: 2020-11-09
 *Project: group-booking-shop-manage-system
 */
import {makeAutoObservable} from "mobx";
class UserStore {
    constructor() {
        makeAutoObservable(this)
    }
    userInfo
    menuInfo
    token
    username
    set userInfo(param){
        localStorage.setItem("userInfo",JSON.stringify(param))
    }
    get userInfo(){
        if (localStorage.getItem("userInfo")){
            return JSON.parse(localStorage.getItem("userInfo"))
        }
        return ""
    }
    set menuInfo(param){
        localStorage.setItem("menuInfo",JSON.stringify(param))
    }
    get menuInfo(){
        if (localStorage.getItem("menuInfo")){
            return JSON.parse(localStorage.getItem("menuInfo"))
        }
        return ""
    }
    set token(param){
        localStorage.setItem("token",JSON.stringify(param))
    }
    get token(){
        if (localStorage.getItem("token")){
            return JSON.parse(localStorage.getItem("token"))
        }
        return ""
    }
    set username(param){
        localStorage.setItem("username",JSON.stringify(param))
    }
    get username(){
        if (localStorage.getItem("username")){
            return JSON.parse(localStorage.getItem("username"))
        }
        return ""
    }

}
export default UserStore
